<script setup>
import {reactive} from 'vue'
import {useRouter} from 'vue-router'

const props = defineProps({
  movieItem: {
    type: Object,
  }
})
const router = useRouter()
const movieItem = reactive(props.movieItem)
const runId = ()=>{
  router.push({path: '/film/', query: {id: props.movieItem.id}})
}
// console.log(movieItem)
</script>

<template>
  <div class="xjt-hot-movie-card">
    <div class="movie-poster">
      <el-image
          class="hvr-grow"
          style="width: 100%; height: 300px"
          :src="movieItem.cover_url"
          fit="fill"></el-image>
       <el-divider border-style="dashed" />
      <div class="movie-score">{{ movieItem.score }}</div>
      <div class="movie-name" @click="runId">{{ movieItem.title }}</div>
    </div>
  </div>
</template>

<style scoped>
.xjt-hot-movie-card {

  position: relative;
  margin-left: 15px;
  margin-right: 15px;
}

.movie-poster {
  border: 1px solid #ddd;
  border-radius: 8px 8px 0 0;
  padding: 10px;
  overflow: hidden;
  position: relative;
}

.el-image {
  width: 100%;
  height: 160px;
}

.movie-overlay {
  position: absolute;
  left: 15px;
  bottom: 15px;
  width: 90%;
  height: 50px;
}

.movie-info {
  color: #fff;
  position: absolute;
  bottom: 7px;
  width: 100%;
  height: 50px;
  line-height: 50px;
}

.movie-name {
  width: 70%;
  float: left;
  font-size: 16px;
  cursor: pointer;
}

.movie-score {
  color: #ffb400;
  float: right;
  margin-right: 5px;
  margin-top: -10px;
  font-size: 24px;
}

.movie-sale {
  border: 1px solid #ddd;
  text-align: center;
  height: 40px;
  line-height: 39px;
  font-size: 18px;
  color: #ef4238;
}

.movie-sale:hover {
  background-color: #ef4238;
  color: white;
}

</style>